home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group03a.txt
/
000091_icon-group-sender_Thu Sep 18 07:29:38 2003.msg
< prev
next >
Wrap
Internet Message Format
|
2003-12-22
|
3KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id h8IET7F18427
for icon-group-addresses; Thu, 18 Sep 2003 07:29:07 -0700 (MST)
Message-Id: <200309181429.h8IET7F18427@baskerville.CS.Arizona.EDU>
To: Steve Wampler <swampler@noao.edu>
cc: icon-group@cs.arizona.edu
Subject: Re: Simple Icon programming challenge...
Date: Wed, 17 Sep 2003 23:15:25 -0700
From: William Griswold <wgg@cs.ucsd.edu>
X-Spam-Status: No, hits=-5.1 required=5.0
tests=BAYES_10,IN_REP_TO
version=2.55
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Hi Steve,
Here is my solution. I got a little too clever for my own good, but
I enjoyed it. :)
--bill
procedure main()
every !&input ? {
while not pos(0) do {
writes(nextpiece())
writes(scrambleinnards(nextpiece()))
}
write()
}
end
#
# Scramble internal letters of a string with replacement. Without seemed
# hard. Note that pretty much any letter-preserving function would work,
# if you didn't care about randomness.
#
procedure scrambleinnards(word)
every !word[2:*word] :=: ?word[2:*word]
return word
end
#
# State machine semantics for retrieving the word and non-word parts
# of a text. First retrieves a non-word, then a word, etc. Would be
# more efficient with a swap rather than a complement.
#
procedure nextpiece()
static current
initial current := &ucase ++ &lcase # letters
return tab(many(current := ~current))
end
In msg <200309172032.h8HKWPJ20725@baskerville.CS.Arizona.EDU>, Steve Wampler sa
ys:
>(This is probably a good string scanning exercise for newer
>Icon programmers...)
>
>Yesterday there were some news reports of a finding from an
>English University on just how well most of us read. In
>particular, they found that people could read nearly as fast
>if the interior letters (all but the first and last) of
>words were scrambled, provided people tried to read it fast
>and didn't spend time focussing on each word.
>
>For example, one scrambling of the above paragraph is:
>
>Ysaeterdy trhee wree smoe nwes roetprs of a fdinnig form an
>Eingslh Usnivetriy on jsut how wlel msot of us raed. In
>paarticulr, tehy fnoud taht ppeloe cloud raed nalery as fsat
>if the ionterir lrettes (all but the fsirt and lsat) of
>wdors wree smcreabld, perovidd pleope tierd to raed it fsat
>and ddin't snped tmie fsocunsig on ecah wrod.
>
>This actually may have profound implications on the ability
>of spam-blocking software to perform properly.
>
>Not that I want to promote spam, but...
>
>Write an Icon (or Unicon!) program that scrambles input
>using to this approach. It would be nice if it produced
>random scramblings (where repeated runs of the program on
>the same input produce different results).
>
>--
>Steve Wampler -- swampler@noao.edu
>Quantum materiae materietur marmota monax si marmota
> monax materiam possit materiari?
>